package com.example.learn.config.listener;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@Component
public class AnnotationUserRegisterListener {
    //  监听用户注册事件
    @EventListener
    public  void sendMailToUser(MyEvent userRegisterEvent){
        System.out.println("---------------------------");
        System.out.println("利用@EventListener注解监听用户注册事件并向用户发送邮件");
        System.out.println("注册用户名：" + userRegisterEvent.getUser().getName());
    }
}

